import styles from "./index.module.scss";
type Props = {
  listPopupClose: () => void;
  type: ListType;
  onUpdateProfile: (type: Exclude<ListType, "">, value: string) => void;
};
const genderList = [
  { text: "男", value: "0" },
  { text: "女", value: "1" },
];
const photoList = [
  { text: "本地选择", value: "local" },
  { text: "默认头像", value: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" },
];
const EditList = ({ listPopupClose, type, onUpdateProfile }: Props) => {
  const onClickItem = (value: string) => {
    if (type === "") return;
    onUpdateProfile(type, value);
  };
  const list = type === "gender" ? genderList : photoList;
  return (
    <div className={styles.root}>
      {list.map((item) => (
        <div
          className="list-item"
          key={item.text}
          onClick={() => onClickItem(item.value)}
        >
          {item.text}
        </div>
      ))}
      {/* <div className="list-item" onClick={() => onClickItem('0')}>
        男
      </div>
      <div className="list-item" onClick={() => onClickItem('1')}>
        女
      </div> */}

      <div className="list-item" onClick={listPopupClose}>
        取消
      </div>
    </div>
  );
};

export default EditList;
